package StudyCode.summary.textfile;

import java.io.DataInput;
import java.io.IOException;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ReadFixedStringFromDataInput {
	public static String readFixedString(DataInput in, int length)
			throws IOException {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < length; i++) {
			char c = in.readChar();
			if (c != 0)
				sb.append(c);
		}
		return sb.toString();
	}
}
